<title>成长档案</title>

<div class="layui-fluid upManager">
    <div class="layui-row">

        <div class="layui-col-md12">

            <div class="layui-card">
                <div class="layui-card-body">
                    <button class="layui-btn layui-btn-sm" data-type="">
                        待认证
                    </button>
                    <hr>
                    <table class="layui-table" id="upEle" lay-filter="up">
                    </table>
                </div>
            </div>
        </div>

    </div>
</div>


<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="view">查看内容</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除内容</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="ban">封禁用户</a>
</script>


<script>
    layui.use(['admin', 'table'], function () {
        var table = layui.table,
            admin = layui.admin;
        var $ = layui.$;

        table.render({
            elem: '#upEle',
            url: './json/task/job.js',
            id: 'up',
            page: 'true',
            cols: [[
                {field: 'user', title: '发布者', width: 120},
                {field: 'class', title: '分类', width:120, sort:true},
                {field: 'title', title: '标题', minWidth: 120, sort: true},
                {field: 'time', title: '发布时间', width: 170},
                {fixed: 'right', align: 'center', toolbar: '#barDemo', width: 240}
            ]]
        });

        //监听工具条
        table.on('tool(up)', function (obj) {
            var data = obj.data;

            if (obj.event === 'view') {

                layer.open({
                    title: '招聘'
                    ,type: 1
                    //,skin: 'layui-layer-rim'
                    ,shadeClose: true
                    ,area: admin.screen() < 2 ? ['80%', '300px'] : ['700px', '500px']
                    ,content: '<div style="padding: 20px;">' +
                    '<div class="layui-form-item"><label class="layui-form-label">图片</label><div class="layui-input-block"><image src="' + data.pic + '"></image></div></div>' +
                    '<div class="layui-form-item"><label class="layui-form-label">主办方</label><div class="layui-input-block"><input type="text" name="title" lay-verify="title" autocomplete="off" value="' + data.user + '" readonly class="layui-input"></div></div>' +
                    '<div class="layui-form-item"><label class="layui-form-label">性质</label><div class="layui-input-block"><input type="text" name="title" lay-verify="title" autocomplete="off" value="' + data.type + '" readonly class="layui-input"></div></div>' +
                    '<div class="layui-form-item"><label class="layui-form-label">活动分类</label><div class="layui-input-block"><input type="text" name="title" lay-verify="title" autocomplete="off" value="' + data.class + '" readonly class="layui-input"></div></div>' +
                    '<div class="layui-form-item"><label class="layui-form-label">标题</label><div class="layui-input-block"><input type="text" name="title" lay-verify="title" autocomplete="off" value="' + data.title + '" readonly class="layui-input"></div></div>' +
                    '<div class="layui-form-item"><label class="layui-form-label">薪酬</label><div class="layui-input-block"><input type="text" name="title" lay-verify="title" autocomplete="off" value="' + data.price + '" readonly class="layui-input"></div></div>' +
                    '<div class="layui-form-item"><label class="layui-form-label">人数</label><div class="layui-input-block"><input type="text" name="title" lay-verify="title" autocomplete="off" value="' + data.num + '" readonly class="layui-input"></div></div>' +
                    '<div class="layui-form-item"><label class="layui-form-label">发布有效期</label><div class="layui-input-block"><input type="text" name="title" lay-verify="title" autocomplete="off" value="' + data.taskBeginTime + ' ~ ' + data.taskEndTime + '" readonly class="layui-input"></div></div>' +
                    '<div class="layui-form-item"><label class="layui-form-label">报名截止时间</label><div class="layui-input-block"><input type="text" name="title" lay-verify="title" autocomplete="off" value="' + data.taskEndEnroll + '" readonly class="layui-input"></div></div>' +
                    '<div class="layui-form-item"><label class="layui-form-label">实践省市</label><div class="layui-input-block"><input type="text" name="title" lay-verify="title" autocomplete="off" value="' + data.region + '" readonly class="layui-input"></div></div>' +
                    '<div class="layui-form-item"><label class="layui-form-label">详细地址</label><div class="layui-input-block"><input type="text" name="title" lay-verify="title" autocomplete="off" value="' + data.address + '" readonly class="layui-input"></div></div>' +
                    '<div class="layui-form-item"><label class="layui-form-label">实践形式</label><div class="layui-input-block"><input type="text" name="title" lay-verify="title" autocomplete="off" value="' + data.onOffLine + '" readonly class="layui-input"></div></div>' +
                    '<div class="layui-form-item"><label class="layui-form-label">描述</label><div class="layui-input-block"> <textarea name="text" readonly class="layui-textarea">' + data.upDesc + '</textarea></div></div>' +
                    '<div class="layui-form-item"><label class="layui-form-label">要求</label><div class="layui-input-block"> <textarea name="text" readonly class="layui-textarea">' + data.upDemand + '</textarea></div></div>' +

                    '</div>'
                });
            } else if (obj.event === 'ban') {
                layer.prompt({
                    formType: 0,
                    title: '封禁原因',
                    area: ['200px', '40px'] //自定义文本域宽高
                }, function (value, index, elem) {
                    alert(value); //得到value
                    layer.close(index);
                });
            } else if (obj.event === 'del') {
                layer.prompt({
                    formType: 0,
                    title: '删除原因',
                    area: ['200px', '40px'] //自定义文本域宽高
                }, function (value, index, elem) {
                    alert(value); //得到value
                    layer.close(index);
                });
            }

        });


    });
</script>